package com.mistralcoast.rule34;

import com.mistralcoast.rule34.R;
import com.mistralcoast.rule34.LazyList.LazyAdapter;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ListView;
import android.widget.Toast;

public class MainActivity extends Activity {
    
//    ListView list;
	GridView gridview;
    LazyAdapter adapter;

//    @Override
//    public void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.pain);
//        
//        list=(ListView)findViewById(R.id.list);
//        adapter=new LazyAdapter(this, mStrings);
//        list.setAdapter(adapter);
//        
//        Button b=(Button)findViewById(R.id.button1);
//        b.setOnClickListener(listener);
//    }
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gallery);
        gridview = (GridView) findViewById(R.id.gridview);
        adapter=new LazyAdapter(this, mStrings);
        gridview.setAdapter(adapter);
    }
    
    @Override
    public void onDestroy()
    {
        adapter.imageLoader.stopThread();
        gridview.setAdapter(null); 
        super.onDestroy();
    }
    
    public OnClickListener listener=new OnClickListener(){
        public void onClick(View arg0) {
            adapter.imageLoader.clearCache();
            adapter.notifyDataSetChanged();
        }
    };
    
    private String[] mStrings={
            "http://thumbs2.booru.org/r34/788/thumbnail_6e07eb333b3e7f016dd756c9dfe41a1391b565c1.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_51979e049c65d735f47d9c170477cb20dbb831b5.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_fb60641eacf0e18c799d6f484f6026f12673b11f.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_7d0fbe9308e42255ff0ecf6680392b6fbe9e9450.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_bd2d034ec457e9b1e2d242c03a9d1b19ab5fbb0e.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_a127d54cb1efa87a891b202110bb417d55fee55c.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_162fc8c5b2039a9fd8eb80a78ef263e1.jpeg",
            "http://thumbs2.booru.org/r34/788/thumbnail_29bf08ed85adc2fd1853554b6b800266.jpeg",
            "http://thumbs2.booru.org/r34/788/thumbnail_d64f22964fcfe9f29581048f57460b4f.jpeg",
            "http://thumbs2.booru.org/r34/788/thumbnail_b2d4703f0fcfb2504b5b4448b3c6f8e2.jpeg",
            "http://thumbs2.booru.org/r34/788/thumbnail_d2b32d28c2edab54984f217901389418.jpeg",
            "http://thumbs2.booru.org/r34/788/thumbnail_ea3ed124566c4eb9b0064bb671ac03cea988a2ed.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_01ca995d7b7097938d0ff28331a2ae508cc50313.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_de20a045db71a4ed898908b02223244d1b23c567.png",
            "http://thumbs2.booru.org/r34/788/thumbnail_9b2299038e719d94346bb89d5f88cb171c437c20.png",
            "http://thumbs2.booru.org/r34/788/thumbnail_e2c8ac830658deb3e800a49f48839c0d0358f80b.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_b7bbf6f76522041419a98172aad48d7eb6ecc5cf.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_892b6acf0d9e8d152515a9349ae6a16cef16db9d.gif",
            "http://thumbs2.booru.org/r34/788/thumbnail_73652840e7b3b5608090bffcbd25eabc0e47b7ad.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_ff4ce73cfc1cf2004e80500891628b30ce295dce.png",
            "http://thumbs2.booru.org/r34/788/thumbnail_ffddb35a4aff282cf06222ce5ef69aa121dfffa8.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_79ece737eec264b8c3df3b02dbad8f4caf35dfd1.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_6e07eb333b3e7f016dd756c9dfe41a1391b565c1.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_51979e049c65d735f47d9c170477cb20dbb831b5.jpg",
            "http://thumbs2.booru.org/r34/788/thumbnail_fb60641eacf0e18c799d6f484f6026f12673b11f.jpg"
    };
}